﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace YJKRevitRampModule.RampDataManager
{
	public class RampDetailCurveFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			Curve curve = null;
			DetailCurve detailCurve = elem as DetailCurve;
			if (detailCurve != null)
			{
				curve = detailCurve.GeometryCurve;
			}
			ModelCurve modelCurve = elem as ModelCurve;
			if (modelCurve != null)
			{
				curve = modelCurve.GeometryCurve;
			}
			if (curve == null)
			{
				return false;
			}
			if (curve.GetType() == typeof(Line))
			{
				return true;
			}
			if (curve.GetType() == typeof(Arc))
			{
				Arc arc = curve as Arc;
				if (arc.IsCyclic && arc.IsBound)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ pos)
		{
			return false;
		}
	}
}
